package fr.upmc.dtgui.tests;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

import fr.upmc.dtgui.robot.RobotStateData;

class SensorDataSender extends Thread {

	final protected BlockingQueue<RobotStateData>	dataQueue ;
	final protected LittleRobot						lr ;

	public						SensorDataSender(LittleRobot lr) {
		super();
		this.lr = lr;
		dataQueue = new ArrayBlockingQueue<RobotStateData>(4) ;
	}

	public BlockingQueue<RobotStateData> getDataQueue() {
		return dataQueue;
	}

	@Override
	public void					run() {
		while (true) {
			dataQueue.clear() ;
			/*
			dataQueue.add(lr.getPositioningData()) ;
			dataQueue.add(lr.getEnergyData()) ;
			dataQueue.add(lr.getSpeedData()) ;
			dataQueue.add(new SteeringData(lr.getSteeringAngle())) ;
			*/
			try {
				Thread.sleep(100) ;
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}

	@Override
	public synchronized void	start() {
		this.dataQueue.clear() ;
		super.start();
	}
}